package com.yxh.lib_base.ext.recycler

import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import androidx.recyclerview.widget.RecyclerView

class FirstTouchRecyclerView @JvmOverloads constructor(
    context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : RecyclerView(context, attrs, defStyleAttr) {
    private var mOnInterceptTouchDown: (() -> Unit)? = null

    override fun onInterceptTouchEvent(e: MotionEvent): Boolean {
        if (e.action == MotionEvent.ACTION_DOWN) {
            mOnInterceptTouchDown?.invoke()
        }
        return super.onInterceptTouchEvent(e)
    }

    override fun performClick(): Boolean {
        return super.performClick()
    }

}